import { request } from '@/utils/request';

/**
 * 查询单个的信息
 */
export function getDictById(id: string) {
  return request.get({ url: `/dict/${id}` });
}

/**
 *
 * @returns 字典数据分页
 */
export function dictPage(params?: any) {
  return request.get({ url: '/dict/page', params });
}

/**
 * 添加字典
 */
export function addDict(data: any) {
  return request.post({ url: '/dict', data });
}

/**
 * 修改字典
 */
export function updateDict(data: any) {
  return request.put({ url: '/dict', data });
}

/**
 * 删除字典
 */
export function deleteDict(id: string) {
  return request.delete({ url: `/dict/${id}` });
}

/**
 *
 * @returns item字典项的分页
 */
export function dictItemPage(params?: { dictId?: number; current: number; size: number }) {
  return request.get({ url: '/dict/item/page', params });
}

/**
 * 单个字典表数据
 */
export function getDictItemById(id: string) {
  return request.get({ url: `/dict/item/${id}` });
}

/**
 * 添加字典项
 */
export function addDictItem(data: any) {
  return request.post({ url: '/dict/item', data });
}

/**
 * 修改字典项
 */
export function updateDictItem(data: any) {
  return request.put({ url: '/dict/item', data });
}

/**
 * 删除字典项
 */
export function deleteDictItem(id: string) {
  return request.delete({ url: `/dict/item/${id}` });
}
